package com.feihong.yw189.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.feihong.yw189.activity.kaika.moneyout.BalanceTurnOutActivity;
import com.feihong.yw189.fragment.moneyout.DpFragment;
import com.feihong.yw189.fragment.moneyout.YhkFragment;
import com.feihong.yw189.fragment.moneyout.ZfbFragment;

import java.util.ArrayList;

/**
 * Created by Sabirjan on 2017/6/13.
 * TXGW.
 * 飞宏电子
 */

public class BalanceAdapter extends FragmentPagerAdapter {

    private static final String[] TITLES = {"转到支付宝", "转到银行卡", "转给其他用户"};
    private static final int[] INDEX = {BalanceTurnOutActivity.BALANCE_STATE_ZFB,
            BalanceTurnOutActivity.BALANCE_STATE_BANK, BalanceTurnOutActivity.BALANCE_STATE_DP};//对应的状态ID

    private ArrayList<Fragment> fragments;

    public BalanceAdapter(FragmentManager fm) {
        super(fm);
        fragments = new ArrayList<>();

        ZfbFragment fragment1 = ZfbFragment.newInstance(TITLES[0]);
        YhkFragment fragment2 = YhkFragment.newInstance(TITLES[1]);
        DpFragment fragment3 = DpFragment.newInstance(TITLES[2]);

        fragments.add(fragment1);
        fragments.add(fragment2);
        fragments.add(fragment3);

    }

    @Override
    public CharSequence getPageTitle(int position) {
        return TITLES[position];
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}
